package archsw0904.controller.catalog;

public class CatalogProxy implements archsw0904.controller.catalog.Catalog {
  private String _endpoint = null;
  private archsw0904.controller.catalog.Catalog catalog = null;
  
  public CatalogProxy() {
    _initCatalogProxy();
  }
  
  public CatalogProxy(String endpoint) {
    _endpoint = endpoint;
    _initCatalogProxy();
  }
  
  private void _initCatalogProxy() {
    try {
      catalog = (new archsw0904.controller.catalog.CatalogServiceLocator()).getCatalogPort();
      if (catalog != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)catalog)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)catalog)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (catalog != null)
      ((javax.xml.rpc.Stub)catalog)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public archsw0904.controller.catalog.Catalog getCatalog() {
    if (catalog == null)
      _initCatalogProxy();
    return catalog;
  }
  
  public archsw0904.controller.catalog.Book[] queryBook(archsw0904.controller.catalog.QueryParam arg0) throws java.rmi.RemoteException, archsw0904.controller.catalog.NullMandatoryFieldException{
    if (catalog == null)
      _initCatalogProxy();
    return catalog.queryBook(arg0);
  }
  
  public archsw0904.controller.catalog.Book[] queryPromotions() throws java.rmi.RemoteException{
    if (catalog == null)
      _initCatalogProxy();
    return catalog.queryPromotions();
  }
  
  public archsw0904.controller.catalog.Book createBook(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4, java.math.BigDecimal arg5, java.lang.String arg6, java.lang.Integer arg7, java.lang.String arg8, boolean arg9, int arg10) throws java.rmi.RemoteException{
    if (catalog == null)
      _initCatalogProxy();
    return catalog.createBook(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
  }
  
  
}